package com.example.testgit.controller;

import com.example.testgit.VO.*;
import com.example.testgit.service.AcademyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/academy")
public class AcademyController {
    @Resource
    private AcademyService academyService;

    @PostMapping("/dormitoryReward")
    public Result<PageResult<DormitoryRewardVO>> dormitory(@RequestBody StudentQuery stu){

        PageResult<DormitoryRewardVO> result =academyService.queryDormitoryReward(stu);

        return Result.success(result);
    }

    @PostMapping("/roomie")
    public Result<List<DormitoryRoomieVO>> queryRoomie(@RequestBody StudentQuery stu){

        List<DormitoryRoomieVO> result = academyService.queryRoomie(stu);

        return Result.success(result);
    }

    @PostMapping("/bed")
    public Result<PageResult<BedVO>> bed(@RequestBody StudentQuery stu){

        PageResult<BedVO> result = academyService.queryBed(stu);

        return Result.success(result);
    }

    @GetMapping("/pie")
    public Result<List<PieVO>> bed(Integer stuId){

        List<PieVO> result = academyService.pie(stuId);

        return Result.success(result);
    }
}
